package org.maitaole.service.impl;

import org.maitaole.entity.CartInfo;
import org.maitaole.entity.SysUser;
import org.maitaole.mapper.CartInfoMapper;
import org.maitaole.service.ICartInfoService;
import org.maitaole.service.ISysUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CartInfoServiceImpl implements ICartInfoService {

    @Resource
    private CartInfoMapper cartInfoMapper;

    @Resource
    private ISysUserService iSysUserService;

    @Override
    public List<CartInfo> getAllCartInfo(String username) {
        SysUser userByUsername = iSysUserService.findUserByUsername(username);
        return cartInfoMapper.getAllCartInfo(userByUsername.getId());
    }
}
